package com.aaa.doctor.controller.api;

import com.aaa.doctor.service.CareOrderService;
import com.aaa.doctor.vo.CareOrderVo;
import com.aaa.entity.CareHistory;
import com.aaa.entity.CareOrder;
import com.aaa.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/doctor/api/CareOrder")
public class ApiCareOrderController {

    @Autowired
    private CareOrderService careOrderService;

    /**
     * 根据病历ID查询处方信息
     * @param chId
     * @return
     */
    @GetMapping("/queryCareOrdersByChId/{chId}")
    public Result<List<CareOrder>> queryCareOrdersByChId(@PathVariable String chId){
        return careOrderService.queryCareOrdersByChId(chId);
    }

    /**
     * 保存用药处方和检查处方
     * @param careOrderVo
     * @return
     */
    @PostMapping("/saveCareOrderItem")
    public Result<String> saveCareOrderItem(@RequestBody CareOrderVo careOrderVo){
        return careOrderService.saveCareOrderItem(careOrderVo);
    }
}
